<div class="authorizations index">
	<h2><?php echo __('Authorizations');?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo $this->Paginator->sort('id');?></th>
			<th><?php echo $this->Paginator->sort('auth_type_id');?></th>
			<th><?php echo $this->Paginator->sort('Project');?></th>
			<th><?php echo $this->Paginator->sort('Domain');?></th>
			<th><?php echo $this->Paginator->sort('description');?></th>
			
			<th class="actions"><?php echo $this->Html->link(__('New Authorization'), array('action' => 'add')); ?></th>
	</tr>
	<?php
	foreach ($authorizations as $authorization): ?>
	<tr>
		<td><?php echo h($authorization['Authorization']['id']); ?>&nbsp;</td>
		<td><?php
			$g = Configure::read('Config.auth_groups'); 
			echo	$g[$authorization['Authorization']['auth_type_id']]; ?>&nbsp;</td>			
		<td><?php if(isset($authorization['Project']) && count($authorization['Project']) != 0 ){ $i=0; foreach ($authorization['Project'] as $project) { echo (($i != 0)?'<br/>':'').$project['domain']; $i++; } } ?>&nbsp;</td>
		<td><?php if(isset($authorization['Domain']) && count($authorization['Domain']) != 0 ){ $i=0; foreach ($authorization['Domain'] as $domain) { echo (($i != 0)?'<br/>':'').$domain['name']; $i++; } } ?>&nbsp;</td>
		<td><?php echo $this->Html->link($authorization['Authorization']['description'],'http://'.$authorization['Authorization']['web_url'],array('escape'=>false)); ?>&nbsp;</td>

		<td class="actions">
			<?php echo $this->Html->link(__('View'), array('action' => 'view', $authorization['Authorization']['id'])); ?>
			<?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $authorization['Authorization']['id'])); ?>
			<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $authorization['Authorization']['id']), null, __('Are you sure you want to delete # %s?', $authorization['Authorization']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
	));
	?>	</p>

	<div class="paging">
	<?php
		echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>
</div>
<div class="actions">
	<?php echo $this->element('/menu/main')?>	
	<?php echo $this->element('/menu/settings')?>	
</div>
